<%@ page import="cn.dgut.Utils.JDBCUtils" %>
<%@ page import="java.util.List" %>
<%@ page import="cn.dgut.Entity.Teacher" %>
<%@ page import="java.util.Map" %>
<%@ page import="cn.dgut.Entity.User" %><%--
  Created by IntelliJ IDEA.
  User: HP
  Date: 2019/6/4
  Time: 23:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    Map<String,String> login = (Map<String, String>) request.getSession().getAttribute("isBackstageLogin");
    if(login!=null){
        int id = Integer.parseInt(login.get("id"));
        User user = (User) new JDBCUtils().queryOneData("User",id);
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="robots" content="all,follow">
    <title>尾音科技信息管理系统</title>
    <link rel="shortcut icon" href="img/logo-title.png">
    <!-- global stylesheets -->
    <!--<link href="https://fonts.googleapis.com/css?family=Roboto+Condensed" rel="stylesheet">-->
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/font-awesome.min.css">
    <link rel="stylesheet" href="css/font-icon-style.css">
    <link rel="stylesheet" href="css/style.default.css" id="theme-stylesheet">
    <!-- Core stylesheets -->
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/main.css">

    <link rel="stylesheet" type="text/css" href="js/umeditor/themes/default/css/umeditor.min.css"/>
    <script type="text/javascript" src="js/umeditor/third-party/jquery.min.js"></script>
    <script type="text/javascript" src="js/umeditor/umeditor.config.js"></script>
    <script type="text/javascript" src="js/umeditor/umeditor.min.js"></script>
    <script type="text/javascript" src="js/umeditor/lang/zh-cn/zh-cn.js"></script>
</head>
<body>
<section style="min-height: 100%;">
    <!--header navbar-->
    <header class="header">
        <nav class="navbar navbar-expand-lg ">
            <div class="search-box">
                <button class="dismiss"><i class="icon-close"></i></button>
                <form id="searchForm" action="#" role="search">
                    <input type="search" placeholder="Search Now" class="form-control">
                </form>
            </div>
            <div class="container-fluid ">
                <div class="navbar-holder d-flex align-items-center justify-content-between">
                    <div class="navbar-header">
                        <a href="index.jsp" class="navbar-brand">
                            <div class="brand-text brand-big hidden-lg-down"><img src="img/logo.png" alt="Logo" class="logo-img"></div>
                            <div class="brand-text brand-small"><img src="img/logo-min.png" alt="Logo" style="height: 30px;width:30px;margin-left: 5px;"></div>
                        </a>
                        <a id="toggle-btn" href="#" class="menu-btn active">
                            <span></span> <span></span> <span></span>
                        </a>
                    </div>
                </div>
                <ul class="nav-menu list-unstyled d-flex flex-md-row align-items-md-center">
                    <!-- 全屏 -->
                    <li class="nav-item d-flex align-items-center full_scr_exp">
                        <a class="nav-link" href="#"><img src="img/expand.png" onclick="toggleFullScreen(document.body)" class="img-fluid" alt=""></a>
                    </li>
                    <!-- 查找 -->
                    <li class="nav-item d-flex align-items-center">
                        <a id="search" class="nav-link" href="#">
                            <i class="icon-search"></i>
                        </a>
                    </li>
                    <li class="nav-item dropdown">
                        <a id="notifications" class="nav-link" rel="nofollow" data-target="#" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            <%=user.getUser_name()%>
                        </a>
                    </li>
                    <li class="nav-item dropdown">
                        <a href="/backLogoutServlet">
                            退出
                        </a>
                    </li>
                </ul>
            </div>
        </nav>
    </header>
    <!--page content-->
    <div class="page-content d-flex align-items-stretch" style="min-height: 88vh;">
        <!-- side navbar -->
        <nav class="side-navbar">
            <div class="sidebar-header d-flex align-items-center">
                <div class="avatar">
                    <img src="img/<%=user.getUser_img()%>" alt="..." class="img-fluid rounded-circle">
                </div>
                <div class="title">
                    <h1 class="h4"><%=user.getUser_name()%></h1>
                </div>
            </div>
            <hr>
            <!-- Sidebar Navidation Menus-->
            <ul class="list-unstyled">
                <li class="active"> <a href="index.jsp"><i class="icon-home"></i>首页</a></li>
                <li><a href="#apps" aria-expanded="false" data-toggle="collapse"> <i class="fa fa-address-book-o"></i>用户信息 </a>
                    <ul id="apps" class="collapse list-unstyled">
                        <li><a href="main_page.jsp?page=0">用户注册</a></li>
                        <li><a href="main_page.jsp?page=1">学员信息</a></li>
                        <li><a href="main_page.jsp?page=2">教员信息</a></li>
                    </ul>
                </li>
                <li> <a href="#course" aria-expanded="false" data-toggle="collapse"><i class="fa fa-pencil-square-o"></i>课程发布</a>
                    <ul id="course" class="collapse list-unstyled">
                        <li><a href="main_page.jsp?page=3">课程列表</a></li>
                        <li><a href="publish_course.jsp">发布课程</a></li>
                    </ul>
                </li>
                <li> <a href="main_page.jsp?page=4"> <i class="fa fa-commenting-o"></i>课程报名</a></li>
                <li> <a href="main_page.jsp?page=5"> <i class="fa fa-file-code-o"></i>学员作品</a></li>
                <li><a href="#forms" aria-expanded="false" data-toggle="collapse"> <i class="fa fa-book"></i>人才招聘 </a>
                    <ul id="forms" class="collapse list-unstyled">
                        <li><a href="main_page.jsp?page=6">招聘列表</a></li>
                        <li><a href="publish_recruitment.jsp">发布招聘</a></li>
                        <li><a href="main_page.jsp?page=7">简历列表</a></li>
                    </ul>
                </li>
            </ul>
        </nav>

        <div class="content-inner">
            <div class="pub_course">
                <div class="pub_header">
                    <h3><i class="fa fa-pencil-square-o"></i>  发表课程</h3>
                </div>
                <div class="pub_content">
                    <form action="/AddCourse" method="post">
                        <div class="form-group">
                            <label>课程名：</label>
                            <input type="text" name="name"  class="form-control" required />
                        </div>
                        <div class="form-group">
                            <label>任课讲师：</label>
                            <select name="teacher" class="form-control" required>
                                <option value="0">-- 请选择任课讲师 --</option>
                                <%
                                    JDBCUtils utils = new JDBCUtils();
                                    List teacherList = utils.queryAllData("Teacher");
                                    for (int i = 0; i < teacherList.size(); i++) {
                                        Teacher temp = (Teacher) teacherList.get(i);
                                %>
                                <option value="<%=temp.getTeacher_id()%>"><%=temp.getTeacher_name()%></option>
                                <%
                                    }
                                %>

                            </select>
                        </div>
                        <div class="form-group">
                            <label>课时：</label>
                            <input type="number" name="hours" class="form-control" required />
                        </div>
                        <div class="form-group">
                            <label>类型：</label>
                            <input type="text" name="type" class="form-control" required />
                        </div>
                        <div class="form-group">
                            <label>开始时间：</label>
                            <input type="datetime-local" name="begintime"  class="form-control" required/>
                        </div>
                        <div class="form-group">
                            <label>学费：</label>
                            <input type="number" name="pay"  class="form-control" required/>
                        </div>
                        <div class="form-group">
                            <label>课程简介：</label>
                            <script type="text/javascript">
                                $(function(){
                                    UM.getEditor('myEditor');
                                });
                            </script>
                            <div type="text/plain" data-isinfo="1" class="form-control change_input" id="myEditor" style="height: 200px;width: 104%;" name="content">

                            </div>
                        </div>
                        <div class="form-group">
                            <label>课程是否上架：</label>
                            <div class="form-control">
                                <input type="radio" value="1" name="isSell" id="asc" /><label for="asc"> 上架</label>
                                <input type="radio" value="0" name="isSell" id="desc" /><label for="desc"> 下架</label>
                            </div>

                        </div>
                        <div style="width: 200px;margin: 10px auto;">
                            <input type="submit" value="提交" class="btn btn-info btn-sm" />
                            <input type="reset" style="margin-left: 100px;"  value="重置" class="btn btn-danger btn-sm" />
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</section>

<!--Global Javascript -->
<script src="js/jquery.min.js"></script>
<script src="js/popper/popper.min.js"></script>
<script src="js/tether.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.cookie.js"></script>
<script src="js/jquery.validate.min.js"></script>
<script src="js/chart.min.js"></script>
<script src="js/front.js"></script>

</body>
</html>

<%
    }else {
        out.println("<h1>您没有权限直接访问此文件！！</h1>");
    }
%>